/**
 * Created by Maibenben on 2017/5/11.
 */
function pullDown(selector) {
    $(function () {
        var startY = 0, endY = 0, moveY = 0;
        window.addEventListener("touchstart", function (e) {
            $(selector).css("transition", "none");
            startY = e.touches[0].clientY;
        });
        window.addEventListener("touchmove", function (e) {
            endY = e.touches[0].clientY;
            moveY = endY - startY;
            $(selector).css("marginBottom", moveY + "px");
        });
        window.addEventListener("touchend", function () {
            if (moveY > 30 && window.scrollY == 0) {
                location.reload();
            } else {
                $(selector).css("transition", "all 0.5s");
                $(selector).css("marginBottom", 0);
            }
            startY = 0;
            endY = 0;
            moveY = 0;
        })
    })
}